﻿<%@ WebHandler Language="C#" Class="SysRose_Add" %>

using System;
using System.Web;
using System.Text;
using Newtonsoft.Json;
public class SysRose_Add : IHttpHandler, System.Web.SessionState.IReadOnlySessionState
{
    
    public void ProcessRequest (HttpContext context) {
 //检验是否登录
        OTS.Common.PageSuccess page = new OTS.Common.PageSuccess();
        if (!OTS.BaseLogin.validataModule(context, (int)OTS.enumSysRight.SysRose))
        {
            page.success = false;
            page.msg = "非法操作！";
        }
        else
        {
            string _rose_name = context.Request["rose.rose_name"];
            string _des = context.Request["rose.des"]; 
            if (null != _rose_name && !"".Equals(_rose_name)  )
            {
                OTS.Model.sys_rose model = new OTS.Model.sys_rose ();
                model.rose_name = _rose_name;
                model.des = _des;
                OTS.BLL.SysRoseBLL bll = new OTS.BLL.SysRoseBLL();
                if (bll.AddSysRose(model))
                {
                    page.success = true;
                    page.msg = "添加成功！";
                }
                else
                {
                    page.success = false;
                    page.msg = "往数据库插入值错误！请稍后再试！";
                }
                
            }
            else
            {
                page.success = false;
                page.msg = "参数有误！";

            }

  
        }

        context.Response.ContentType = "application/x-json";
        context.Response.Charset = "utf-8";
        context.Response.Write(JavaScriptConvert.SerializeObject(page));
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}